<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_shipping_area.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.trade.ti_shipping_area.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>

<%
	request.setCharacterEncoding("UTF-8");
	Ti_shipping_area ti_shipping_area = new Ti_shipping_area();
	String g_shipping_id="";	
	if(request.getParameter("shipping_id")!=null) g_shipping_id = request.getParameter("shipping_id");
	ti_shipping_area.setShipping_id(g_shipping_id);
	String s_title = "",g_area_id="";
	if(request.getParameter("shipping_area_name")!=null && !request.getParameter("shipping_area_name").equals("")){
		s_title = request.getParameter("shipping_area_name");
		ti_shipping_area.setShipping_area_name(s_title);
	}
	if(request.getParameter("area_id")!=null && !request.getParameter("area_id").equals("")){
		g_area_id = request.getParameter("area_id");
		ti_shipping_area.setArea_id(g_area_id);
	}

	Ti_shipping_areaInfo ti_shipping_areaInfo = new Ti_shipping_areaInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_shipping_areaInfo.getListByPage(ti_shipping_area,Integer.parseInt(iStart),limit);
	int counter = ti_shipping_areaInfo.getCountByObj(ti_shipping_area);
	String pageString = new PageTools().getGoogleToolsBar(counter,"shipping_areaindex.jsp?area_id="+g_area_id+"&shipping_id="+g_shipping_id+"&shipping_area_name="+s_title+"&iStart=",Integer.parseInt(iStart),limit);
    Ti_shipping_areaInfo areainfo = new Ti_shipping_areaInfo();
		 String selectname =areainfo.getareanameSelectItem("");
%>
<html>
  <head>
    
    <title>配送方式区域设置</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>配送方式区域设置管理</h1>
			</td>
			<td>
				<a href="shipping_areaaddInfo.jsp?shipping_id=<%=g_shipping_id%>"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="shipping_areaindex.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
			按地区：
			<select name="area_id" id="area_id" style="width:80px;">
					  <option value="">请选择</option>
					  <%=selectname%>
				</select>
				<input name="searchInfo" type="button" value="查询" class="buttab" onclick="searchname();" />
				<input type="button" class="buttab" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
			<td align="left" >
			</td>
		</tr>
	</table>
		<script>
		function searchname(){

		document.indexForm.submit();
		}
		</script>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计：<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
		  	<th>地区</th>
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String shipping_area_id="",shipping_area_name="",area_name="",shipping_id="",area_id="",cal_type="",one_fare="",first_fare="",con_fare="",free_fare="",arrive_fare="",in_date="";
					if(map.get("shipping_area_id")!=null) shipping_area_id = map.get("shipping_area_id").toString();
					if(map.get("shipping_area_name")!=null) shipping_area_name = map.get("shipping_area_name").toString();
					if(map.get("shipping_id")!=null) shipping_id = map.get("shipping_id").toString();
					if(map.get("area_id")!=null){ 
					area_id = map.get("area_id").toString();
					area_name=areainfo.getareanameById(area_id);
					}
					if(map.get("cal_type")!=null) cal_type = map.get("cal_type").toString();
					if(map.get("one_fare")!=null) one_fare = map.get("one_fare").toString();
					if(map.get("first_fare")!=null) first_fare = map.get("first_fare").toString();
					if(map.get("con_fare")!=null) con_fare = map.get("con_fare").toString();
					if(map.get("free_fare")!=null) free_fare = map.get("free_fare").toString();
					if(map.get("arrive_fare")!=null) arrive_fare = map.get("arrive_fare").toString();
					if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
				  if(in_date.length()>19)in_date=in_date.substring(0,19);

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=shipping_area_id %>" /></td>
			
		  	<td><%=area_name%></td>
		  	
			<td width="10%"><a href="shipping_areaupdateInfo.jsp?shipping_area_id=<%=shipping_area_id %>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=shipping_area_id%>','1606');"><img src="/program/admin/images/delete.gif" title="删除" /></a></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
				
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="shipping_id" id="shipping_id" value="<%=g_shipping_id%>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="1606" />
	  </form>
</body>

</html>
